<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRelationDefineTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('relation_define', function (Blueprint $table) {
            $table->bigInteger('id', true);
            $table->string('form_key', 255)->comment('表单的key');
            $table->string('form_feild', 255)->comment('表单字段名');
            $table->string('entity_class', 255)->nullable();
            $table->string('repository_class', 255)->nullable();
            $table->string('entity_feild', 255)->nullable();
            $table->string('component_type', 255)->comment('组件类型枚举值 AtomXComponent / CompositeXComponent');
            $table->dateTime('create_time')->useCurrent();
            $table->bigInteger('creator_id')->nullable();
            $table->dateTime('update_time')->useCurrent();
            $table->bigInteger('updater_id')->nullable();
            $table->integer('deleted')->nullable()->default(0);
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('relation_define');
    }
};
